package com.robusta.app.auth.model;

import java.util.Date;
import java.util.Random;
import java.util.UUID;

public class UserSessionModelFixture {
    private Long id;
    private String token;
    private UserModel loggedInUser;

    private UserSessionModelFixture() {
    }

    public static UserSessionModelFixture aUserSessionModel() {
        return new UserSessionModelFixture();
    }

    public UserSessionModelFixture withDefaults() {
        Random random = new Random();
        this.id = random.nextLong();
        this.token = UUID.randomUUID().toString();
        return this;
    }

    public UserSessionModel build() {
        return new UserSessionModel(id, token, new Date(), loggedInUser);
    }

    public UserSessionModelFixture withLoggedInUser(UserModel loggedInUser) {
        this.loggedInUser = loggedInUser; return this;
    }

    public UserSessionModelFixture withAuthToken(String generatedToken) {
        this.token = generatedToken; return this;
    }
}
